/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJPanel.java
 *
 * Created on Oct 5, 2010, 11:57:17 PM
 */
package cat20032010;

import javax.swing.JOptionPane;

/**
 *
 * @author Aizat
 */
public class TableArrangement extends javax.swing.JPanel {
    static public String table_chosen = "asdio";
    String status = "occupied";

    Boolean chosen = false ;
    /** Creates new form NewJPanel */
    public TableArrangement() {
        initComponents();
        table9p.setVisible(false);
        table8p.setVisible(false);
        table7p.setVisible(false);
        table6p.setVisible(false);
        table5p.setVisible(false);
        table4p.setVisible(false);
        table3p.setVisible(false);
        table2p.setVisible(false);
        table1p.setVisible(false);

    }
public void resetTable(int tableNum){
    switch (tableNum)
    {
    case 1 : table1p.setVisible(false);table1.setVisible(true);break;
    case 2 : table2p.setVisible(false);table2.setVisible(true);break;
    case 3 : table3p.setVisible(false);table3.setVisible(true);break;
    case 4 : table4p.setVisible(false);table4.setVisible(true);break;
    case 5 : table5p.setVisible(false);table5.setVisible(true);break;
    case 6 : table6p.setVisible(false);table6.setVisible(true);break;
    case 7 : table7p.setVisible(false);table7.setVisible(true);break;
    case 8 : table8p.setVisible(false);table8.setVisible(true);break;
    case 9 : table9p.setVisible(false);table9.setVisible(true);break;
    
    }
}
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel6 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        table9p = new javax.swing.JButton();
        table9 = new javax.swing.JButton();
        table8p = new javax.swing.JButton();
        table8 = new javax.swing.JButton();
        table7p = new javax.swing.JButton();
        table7 = new javax.swing.JButton();
        table6p = new javax.swing.JButton();
        table6 = new javax.swing.JButton();
        table5p = new javax.swing.JButton();
        table5 = new javax.swing.JButton();
        table4p = new javax.swing.JButton();
        table4 = new javax.swing.JButton();
        table3p = new javax.swing.JButton();
        table3 = new javax.swing.JButton();
        table2p = new javax.swing.JButton();
        table2 = new javax.swing.JButton();
        table1p = new javax.swing.JButton();
        table1 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setMaximumSize(new java.awt.Dimension(620, 460));
        setMinimumSize(new java.awt.Dimension(620, 460));
        setLayout(null);

        jPanel1.setOpaque(false);
        jPanel1.setLayout(null);

        jLabel3.setFont(new java.awt.Font("Lucida Grande", 0, 16));
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Vacant");
        jPanel1.add(jLabel3);
        jLabel3.setBounds(470, 90, 80, 30);

        jLabel4.setFont(new java.awt.Font("Lucida Grande", 0, 16));
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Occupied");
        jPanel1.add(jLabel4);
        jLabel4.setBounds(470, 190, 80, 21);

        jSeparator1.setBackground(new java.awt.Color(0, 0, 0));
        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jPanel1.add(jSeparator1);
        jSeparator1.setBounds(370, 20, 20, 280);

        jLabel6.setFont(new java.awt.Font("Lucida Grande", 0, 18));
        jLabel6.setForeground(new java.awt.Color(255, 255, 255));
        jLabel6.setText("LEGEND");
        jPanel1.add(jLabel6);
        jLabel6.setBounds(440, 10, 90, 40);

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Legend Button/cooltext473751267.png"))); // NOI18N
        jLabel5.setText("jLabel5");
        jPanel1.add(jLabel5);
        jLabel5.setBounds(380, 70, 80, 80);

        jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Legend Button/cooltext473751520.png"))); // NOI18N
        jLabel7.setText("jLabel7");
        jPanel1.add(jLabel7);
        jLabel7.setBounds(380, 160, 80, 80);

        table9p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/button/p9.png"))); // NOI18N
        table9p.setBorderPainted(false);
        table9p.setContentAreaFilled(false);
        table9p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table9pActionPerformed(evt);
            }
        });
        jPanel1.add(table9p);
        table9p.setBounds(270, 220, 80, 80);

        table9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/button/9.png"))); // NOI18N
        table9.setBorderPainted(false);
        table9.setContentAreaFilled(false);
        table9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table9ActionPerformed(evt);
            }
        });
        jPanel1.add(table9);
        table9.setBounds(270, 220, 80, 80);

        table8p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/p8.png"))); // NOI18N
        table8p.setBorderPainted(false);
        table8p.setContentAreaFilled(false);
        table8p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table8pActionPerformed(evt);
            }
        });
        jPanel1.add(table8p);
        table8p.setBounds(150, 220, 80, 80);

        table8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/8.png"))); // NOI18N
        table8.setBorderPainted(false);
        table8.setContentAreaFilled(false);
        table8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table8ActionPerformed(evt);
            }
        });
        jPanel1.add(table8);
        table8.setBounds(150, 220, 80, 80);

        table7p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/p7.png"))); // NOI18N
        table7p.setBorderPainted(false);
        table7p.setContentAreaFilled(false);
        table7p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table7pActionPerformed(evt);
            }
        });
        jPanel1.add(table7p);
        table7p.setBounds(20, 220, 80, 80);

        table7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/7.png"))); // NOI18N
        table7.setBorderPainted(false);
        table7.setContentAreaFilled(false);
        table7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table7ActionPerformed(evt);
            }
        });
        jPanel1.add(table7);
        table7.setBounds(20, 220, 80, 80);

        table6p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/p6.png"))); // NOI18N
        table6p.setBorderPainted(false);
        table6p.setContentAreaFilled(false);
        table6p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table6pActionPerformed(evt);
            }
        });
        jPanel1.add(table6p);
        table6p.setBounds(270, 120, 80, 80);

        table6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/6.png"))); // NOI18N
        table6.setBorderPainted(false);
        table6.setContentAreaFilled(false);
        table6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table6ActionPerformed(evt);
            }
        });
        jPanel1.add(table6);
        table6.setBounds(270, 120, 80, 80);

        table5p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/p5.png"))); // NOI18N
        table5p.setBorderPainted(false);
        table5p.setContentAreaFilled(false);
        table5p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table5pActionPerformed(evt);
            }
        });
        jPanel1.add(table5p);
        table5p.setBounds(150, 120, 80, 80);

        table5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/5.png"))); // NOI18N
        table5.setBorderPainted(false);
        table5.setContentAreaFilled(false);
        table5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table5ActionPerformed(evt);
            }
        });
        jPanel1.add(table5);
        table5.setBounds(150, 120, 80, 80);

        table4p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/p4.png"))); // NOI18N
        table4p.setBorderPainted(false);
        table4p.setContentAreaFilled(false);
        table4p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table4pActionPerformed(evt);
            }
        });
        jPanel1.add(table4p);
        table4p.setBounds(20, 120, 80, 80);

        table4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/4.png"))); // NOI18N
        table4.setBorderPainted(false);
        table4.setContentAreaFilled(false);
        table4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table4ActionPerformed(evt);
            }
        });
        jPanel1.add(table4);
        table4.setBounds(20, 120, 80, 80);

        table3p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/p3.png"))); // NOI18N
        table3p.setBorderPainted(false);
        table3p.setContentAreaFilled(false);
        table3p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table3pActionPerformed(evt);
            }
        });
        jPanel1.add(table3p);
        table3p.setBounds(270, 20, 80, 80);

        table3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/3.png"))); // NOI18N
        table3.setBorderPainted(false);
        table3.setContentAreaFilled(false);
        table3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table3ActionPerformed(evt);
            }
        });
        jPanel1.add(table3);
        table3.setBounds(270, 20, 80, 80);

        table2p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/p2.png"))); // NOI18N
        table2p.setBorderPainted(false);
        table2p.setContentAreaFilled(false);
        table2p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table2pActionPerformed(evt);
            }
        });
        jPanel1.add(table2p);
        table2p.setBounds(150, 20, 80, 80);

        table2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/2.png"))); // NOI18N
        table2.setBorderPainted(false);
        table2.setContentAreaFilled(false);
        table2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table2ActionPerformed(evt);
            }
        });
        jPanel1.add(table2);
        table2.setBounds(150, 20, 80, 80);

        table1p.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/p1.png"))); // NOI18N
        table1p.setBorderPainted(false);
        table1p.setContentAreaFilled(false);
        table1p.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table1pActionPerformed(evt);
            }
        });
        jPanel1.add(table1p);
        table1p.setBounds(20, 20, 80, 80);

        table1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Table Button/1.png"))); // NOI18N
        table1.setBorderPainted(false);
        table1.setContentAreaFilled(false);
        table1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                table1ActionPerformed(evt);
            }
        });
        jPanel1.add(table1);
        table1.setBounds(20, 20, 80, 80);

        add(jPanel1);
        jPanel1.setBounds(10, 100, 590, 310);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Others/Table_Arrangement.png"))); // NOI18N
        add(jLabel2);
        jLabel2.setBounds(120, 0, 360, 110);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Others/background.png"))); // NOI18N
        jLabel1.setMaximumSize(new java.awt.Dimension(620, 460));
        jLabel1.setMinimumSize(new java.awt.Dimension(620, 460));
        jLabel1.setPreferredSize(new java.awt.Dimension(620, 460));
        add(jLabel1);
        jLabel1.setBounds(0, 0, 620, 420);
    }// </editor-fold>//GEN-END:initComponents

    private void table9pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table9pActionPerformed
        // TODO add your handling code here:
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 9 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table9.setVisible(true);
            table9p.setVisible(false);
        }
    }//GEN-LAST:event_table9pActionPerformed

    private void table9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table9ActionPerformed
        // TODO add your handling code here:
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 9 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table9.setVisible(false);
            table9p.setVisible(true);
        }
        
    }//GEN-LAST:event_table9ActionPerformed

    private void table8pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table8pActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 8 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table8.setVisible(true);
            table8p.setVisible(false);
        }
    }//GEN-LAST:event_table8pActionPerformed

    private void table8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table8ActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 8 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table8.setVisible(false);
            table8p.setVisible(true);
        }
    }//GEN-LAST:event_table8ActionPerformed

    private void table7pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table7pActionPerformed
        // TODO add your handling code here:
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 7 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table7.setVisible(true);
            table7p.setVisible(false);
        }
    }//GEN-LAST:event_table7pActionPerformed

    private void table7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table7ActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 7 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table7.setVisible(false);
            table7p.setVisible(true);
        }
    }//GEN-LAST:event_table7ActionPerformed

    private void table6pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table6pActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 6 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table6.setVisible(true);
            table6p.setVisible(false);
        }
    }//GEN-LAST:event_table6pActionPerformed

    private void table6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table6ActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 6 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table6.setVisible(false);
            table6p.setVisible(true);
        }
    }//GEN-LAST:event_table6ActionPerformed

    private void table5pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table5pActionPerformed
       int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 5 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table5.setVisible(true);
            table5p.setVisible(false);
        }
    }//GEN-LAST:event_table5pActionPerformed

    private void table5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table5ActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 5 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table5.setVisible(false);
            table5p.setVisible(true);
        }
    }//GEN-LAST:event_table5ActionPerformed

    private void table4pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table4pActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 4 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table4.setVisible(true);
            table4p.setVisible(false);
        }
    }//GEN-LAST:event_table4pActionPerformed

    private void table4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table4ActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 4 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table4.setVisible(false);
            table4p.setVisible(true);
        }
    }//GEN-LAST:event_table4ActionPerformed

    private void table3pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table3pActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 3 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table3.setVisible(true);
            table3p.setVisible(false);
        }
    }//GEN-LAST:event_table3pActionPerformed

    private void table3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table3ActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 3 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table3.setVisible(false);
            table3p.setVisible(true);
        }
    }//GEN-LAST:event_table3ActionPerformed

    private void table2pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table2pActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 2 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table2.setVisible(true);
            table2p.setVisible(false);
        }
    }//GEN-LAST:event_table2pActionPerformed

    private void table2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table2ActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 2 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table2.setVisible(false);
            table2p.setVisible(true);
        }
    }//GEN-LAST:event_table2ActionPerformed

    private void table1pActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table1pActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 1 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table1.setVisible(true);
            table1p.setVisible(false);
        }
    }//GEN-LAST:event_table1pActionPerformed

    private void table1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_table1ActionPerformed
        int reply = JOptionPane.showConfirmDialog(null, "Comfirm To Change Table 1 Status?", "Comfirm", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION){
            table1.setVisible(false);
            table1p.setVisible(true);
        }
    }//GEN-LAST:event_table1ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JButton table1;
    private javax.swing.JButton table1p;
    private javax.swing.JButton table2;
    private javax.swing.JButton table2p;
    private javax.swing.JButton table3;
    private javax.swing.JButton table3p;
    private javax.swing.JButton table4;
    private javax.swing.JButton table4p;
    private javax.swing.JButton table5;
    private javax.swing.JButton table5p;
    private javax.swing.JButton table6;
    private javax.swing.JButton table6p;
    private javax.swing.JButton table7;
    private javax.swing.JButton table7p;
    private javax.swing.JButton table8;
    private javax.swing.JButton table8p;
    private javax.swing.JButton table9;
    private javax.swing.JButton table9p;
    // End of variables declaration//GEN-END:variables

}
